DIGIT = {digit: i for i, digit in enumerate('〇一二三四五六七八九')}
MIDDLE_UNIT = {unit: 10**i for i, unit in enumerate('十百千', 1)}
BIG_UNIT = {unit: 10000**i for i, unit in enumerate('万億', 1)}

def arabic(kanji):
    small = middle = big = 0
    for c in kanji:
        if c in DIGIT:
            small = small * 10 + DIGIT[c]
        elif c in MIDDLE_UNIT:
            middle += (small or 1) * MIDDLE_UNIT[c]
            small = 0
        elif c in BIG_UNIT:
            big += (small + middle or 1) * BIG_UNIT[c]
            small = middle = 0
        else:
            raise ValueError('非法字符串')
    return big + middle + small



print(arabic("千"))